package com.googlecode.jawb.tests.loading2;

import static org.junit.Assert.assertEquals;

import java.io.ByteArrayInputStream;

import org.junit.Test;

import com.googlecode.jawb.JAWB;

public class Loading2 {
	@Test()
	public void complexLoading() throws Exception {
		ByteArrayInputStream stream = new ByteArrayInputStream(new byte[]{
			(byte) 0x06,							// signature
			(byte) 0x03,							// count
			
			(byte) 0x01, (byte) 0x02, (byte) 0x03,	// value(s)
		});
		
		Loading2_A result = (Loading2_A) new JAWB().loadFrom(stream, Loading2_A.class);
		
		
		assertEquals(result.b.signature, (byte) 0x06);
		assertEquals(result.b.count, (byte) 0x03);
		
		assertEquals(result.b.elements[0].value, (byte) 0x01);
		assertEquals(result.b.elements[1].value, (byte) 0x02);
		assertEquals(result.b.elements[2].value, (byte) 0x03);
	}
}
